package com.woniuxy.carrental.service.impl;

import com.woniuxy.carrental.entity.CCC;
import com.woniuxy.carrental.entity.Purchase;
import com.woniuxy.carrental.mapper.PurchaseMapper;
import com.woniuxy.carrental.service.PurchaseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author xilei
 * @create 2021-10-05 上午 8:37
 */
@Service
public class PurchaseServiceImpl implements PurchaseService {

    @Resource
    PurchaseMapper purchaseMapper;


    @Override
    public void insertPurchase(String purchase_id, Date purchase_date, String car_name, String carpart_name, String supplier_name, Integer car_count, Integer part_count, Integer part_allsprice, Integer car_allsprice, Boolean wareingstatus) {
        purchaseMapper.insertPurchase(purchase_id, purchase_date, car_name, carpart_name, supplier_name, car_count, part_count, part_allsprice, car_allsprice,wareingstatus);
    }

    @Override
    public void deletePurchase(String purchase_id) {
        purchaseMapper.deletePurchase(purchase_id);
    }


    @Override
    public List<Purchase> findPurchase() {
        List<Purchase> list = purchaseMapper.findPurchase();
        return list;
    }

    @Override
    public List<Purchase> findPurchaseByPage(Integer pageIndex, Integer pageSize) {
        List<Purchase> list = purchaseMapper.findPurchaseByPage(pageIndex, pageSize);
        return list;
    }

    @Override
    public List<Purchase> findPurchaseByPageByParam(Integer purchase_id, Date purchase_date, String car_name, String carpart_name, String supplier_name, Integer pageIndex, Integer pageSize) {
        List<Purchase> list = purchaseMapper.findPurchaseByPageByParam(purchase_id, purchase_date, car_name, carpart_name, supplier_name, pageIndex, pageSize);
        return list;
    }

    @Override
    public List<CCC> findPurchaseBy111() {
        List<CCC> by111 = purchaseMapper.findPurchaseBy111();
        return by111;
    }


    //肖某的查询所有采购订单状态为true 分页
    @Override
    public List<Purchase> findPurchaseByPage1(Integer pageIndex, Integer pageSize, boolean wareingstatus) {


        return null;
    }

    //查询所有可以入库的订单
    @Override
    public List<Purchase> selectAllByTrue() {
        List<Purchase> purchases = purchaseMapper.selectAllBytrue();
        return purchases;
    }
}
